//
//  ZGLChannelTableViewCell.m
//  Faker
//
//  Created by dllo on 15/11/1.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "ZGLChannelTableViewCell.h"
#import "ZGLChannelModel.h"
#import <UIImageView+AFNetworking.h>


@interface ZGLChannelTableViewCell ()

@property (nonatomic, strong) UIImageView *titleImage;
@property (nonatomic, strong) UILabel *titleLabel;

@end

@implementation ZGLChannelTableViewCell



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.titleImage = [[UIImageView alloc] init];
        self.titleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.titleImage];
    }
    return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.backgroundColor = foreColor;
    [self.titleImage setFrame:CGRectMake(ScaleX * 20, ScaleY * 12, ScaleX * 36, ScaleY * 36)];
    [self.titleLabel setFrame:CGRectMake(ScaleX * 70, ScaleY * 23, ScaleX * 150, ScaleY * 14)];
    [self.titleLabel setFont:[UIFont systemFontOfSize:13]];
    self.titleLabel.textColor = artiColor;

}

- (void)setChannelModel:(ZGLChannelModel *)channelModel {
    if (_channelModel != channelModel) {
        _channelModel = channelModel;
    }
    self.titleLabel.text = channelModel.title;
    [self.titleImage setImageWithURL:[NSURL URLWithString:channelModel.list_icon] placeholderImage:[UIImage imageNamed:@"placeholder"]];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
